package com.example.dell.fastshopping.user.modle;

import android.arch.lifecycle.MutableLiveData;
import android.arch.lifecycle.ViewModel;

import com.example.dell.fastshopping.network.ApiService;
import com.example.dell.fastshopping.network.NetCallback;
import com.example.dell.fastshopping.network.RetrofitClient;
import com.example.dell.fastshopping.network.http.BaseResponse;
import com.example.dell.fastshopping.user.entity.Balance;

import java.util.ArrayList;
import java.util.List;

import retrofit2.Response;

public class MoneyActivityMolder extends ViewModel {
    private MutableLiveData<List<Balance>> balance = new MutableLiveData<>();
    private ApiService service = RetrofitClient.getInstance().create(ApiService.class);

    public List<String> getList() {
        ArrayList<String> objects = new ArrayList<>();
        return objects;
    }

    public MutableLiveData<List<Balance>> getBalance(int pageNum, int pageSize) {
        RetrofitClient.execute(service.getBalance(pageNum,pageSize), new NetCallback<BaseResponse<List<Balance>>>() {
            @Override
            public void netCallback(BaseResponse<List<Balance>> o) {
                balance.setValue(o.getData());
            }
        });
        return balance;
    }
}

